<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:useBean id="member" class="admin.member.MemberDao" scope="page"/>
<jsp:useBean id="code" class="code.codeDao" scope="page"/>
<%@ page import="admin.member.MemberModel" %>
<%@ page import="code.codeModel" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.List" %>
<%
	HashMap	paramMap = new HashMap();
	String	pageName = "lst.jsp";
	int		giSelectPage  	= Integer.parseInt(request.getParameter("txtSelectPage") == null ? "0" :request.getParameter("txtSelectPage"));			//현재 선택된 페이지 저장
	int		giSelectBlock 	= Integer.parseInt(request.getParameter("txtSelectBlock") == null ? "0" :request.getParameter("txtSelectBlock"));			//현재 선택된 블락페이지 저장
	String	searchGubn		= request.getParameter("searchGubn") == null ? "" : request.getParameter("searchGubn");
	String	searchValue		= request.getParameter("searchValue") == null ? "" : request.getParameter("searchValue");
	String	id				= request.getParameter("id") == null ? "" : request.getParameter("id");
	
	paramMap.put("id",id);
	
	ArrayList returnList	=  member.getView(paramMap);
	MemberModel model	= new MemberModel();
	List list1 = code.getDtlList("100");
	List list2 = code.getDtlList("101");
	if(returnList != null && returnList.size() > 0){
		model = (MemberModel)returnList.get(0);		
	}
	
	String mode = request.getParameter("mode") == null ? "I" : request.getParameter("mode");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>회원관리</title>
<script type="text/javascript" src="/admin/js/default.js"></script>
<script type="text/javascript" src="/admin/js/jquery-1.3.2.min.js"></script>
<link href="/admin/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
$(document).ready(function(){
	$('#lstBtn').click(function() {
		window.location="lst.jsp";
	});
	$('#delBtn').click(function() {
		if (confirm('삭제하시겠습니까?')) {
			var f = document.getElementById("frm");
			f.mode.value ="D";
			f.action = "dbx.jsp";
			f.submit();
		}		
	});
});
//-->
</script>
</head>
<body>
<!-- Header  Start -->
<div id="bodywrap">
<div class="all-wrap">
<%@ include file="/admin/common/top.jsp" %>
<div id="right-wrap">
<%@ include file="/admin/common/navi.jsp" %>
<!--Contents Start-->
<div id="content">
<div class="path"><span>home</span> >  회원관리 </div>
<h4>회원</h4>
<p class="sub-text">회원 관리 하실 수 있습니다.</p>

<form name="frm" id="frm" action="wrt.jsp" method="post" >
<input type="hidden" name="mode" value="U" />
<input type="hidden" name="searchGubn" value="<%=searchGubn %>" />
<input type="hidden" name="searchValue" value="<%=searchValue %>" />
<input type="hidden" name="txtSelectPage" value="<%=giSelectPage %>" />
<input type="hidden" name="txtSelectBlock" value="<%=giSelectBlock %>" />
<input type="hidden" name="idx" value="<%=model.getIdx() %>" />
<table class="view-normal" cellpadding="0" cellspacing="0" summary="이벤트" >
        <caption>회원</caption>
            <col width="130px" />
            <col width="90px" />  
            <col width="40px" />  
            <col /> 
          <tbody>
			<tr>
              <th scope="row" >ID</th>
              <td style="width:350px;">
              	<%=model.getId() %>
              	<input type="hidden" name="id" value="<%=model.getId() %>" />
              </td>
              <th scope="row" style="width:50px;">등록일</th>
              <td><%=model.getCreatedate() %></td>              
            </tr>
            <tr>
              <th scope="row" >비밀번호</th>
              <td colspan="3">******</td>              
            </tr>  
			<tr>
              <th scope="row" >이름</th>
              <td colspan="3"><%=model.getName() %></td>
            </tr>    
            <tr>
              <th scope="row" >생년월일</th>
              <td colspan="3">
              	<%
              		if (model.getJumin().length() >= 13){
              			
              			out.println("19"+model.getJumin().substring(0,2)+"년 ");
              			out.println(model.getJumin().substring(2,4)+"월 ");
              			out.println(model.getJumin().substring(4,6)+"일 ");
              			
              		}
              	%>
              </td>              
            </tr>        
            <tr>
              <th scope="row" >성별</th>
              <td colspan="3">
              	<%
              		if ( model.getSex().equals("M") ){
              			out.println("남");
              		} else {
              			out.println("여");
              		}
              	%>
              </td>              
            </tr>            
            <tr>
              <th scope="row" >e-mail</th>
              <td colspan="3"><%=model.getEmail() %></td>              
            </tr>     
            <tr>
              <th scope="row" >핸드폰</th>
              <td colspan="3"><%=model.getHp() %></td>              
            </tr>     
            <tr>
              <th scope="row" >우편번호</th>
              <td colspan="3">
              	<%
              		if ( model.getZipcode().length() >= 6 ){
              			out.println(model.getZipcode().substring(0,3)+"-"+model.getZipcode().substring(3));
              		}
              	%>
           	  </td>              
            </tr>      
            <tr>
              <th scope="row" >주소</th>
              <td colspan="3"><%=model.getAddr1()+ " " +model.getAddr2() %></td>              
            </tr>     
            <tr>
              <th scope="row" >결혼여부</th>
              <td colspan="3">
              	
              	<%
              		if ( model.getWedding_yn().equals("Y") ){
              			out.println("초혼");
              		} else {
              			out.println("재혼");
              		}
              	%>
              </td>              
            </tr>  
            <tr>
              <th scope="row" >최종학력</th>
              <td colspan="3">
              	<%
              	
              		String academic[] = {"","고등학교졸","전문대","대학교","대학원(재학중)","대학원(중퇴)","대학원(졸업)","박사이상","기타"};
              	
              	%>
              	<%=academic[Integer.parseInt(model.getAcademic())] %>
              </td>              
            </tr>  
            <tr>
              <th scope="row" >사용자등급</th>
              <td colspan="3">
		        <select id="select-grade" class="selectMain" style="width: 80px;" name="grade" disabled="disabled">
			<%
			for(int i = 0; i<list2.size(); i++){
				codeModel codemodel = (codeModel)list2.get(i);
				
			%>
			      <option value="<%=codemodel.getCode() %>" <%if(codemodel.getCode().equals(model.getGrade())){%>selected="selected"<%}%>><%=codemodel.getCodename()%></option>
			<%
			} 
			%> 		        
				</select>
			  </td>              
            </tr>            
                   
            <tr>
              <th scope="row" >탈퇴여부</th>
              <td colspan="3"><% if(model.getUseyn().equals("Y")){%>가입<%}else{ %>탈퇴<%} %></td>              
            </tr>            
          </tbody>       
</table>
<div class="btn-all-align2 pd-b20">
<span class="btn-align"><input type="button" value="목록" class="btn-bg-gray"  id="lstBtn" /></span>
<span class="btn-align"><input type="submit" value="수정" class="btn-bg-gray"  /></span>
<span class="btn-align"><input type="button" value="삭제" class="btn-bg-gray"  id="delBtn" /></span>
</div>
</form>
<!--Contents End-->
</div>
</div>
</div>
<!--Footer Start-->
<%@ include file="/admin/common/bottom.jsp" %>
<!--Footer End-->
</body>
</html>
